package com.matt.docpro.service;

import com.matt.docpro.mapper.AppointmentMapper;
import com.matt.docpro.model.Appointment;
import com.matt.docpro.model.Patient;
import com.matt.docpro.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * AppointmentService
 * Created by on 2024/02/20.
 */
@Service
public class AppointmentService {

    @Autowired
    AppointmentMapper appointmentMapper;

    public List<Appointment> getAll() {
        return appointmentMapper.getAll();
    }

    public List<Appointment> getByPatId(String patientId) {
        return appointmentMapper.getByPatId(patientId);
    }

    public List<Appointment> getByDocId(String docId) {
        return appointmentMapper.getByDocId(docId);
    }

    public int getPatCountByDocId(String docId) {
        return appointmentMapper.getPatCountByDocId(docId);
    }

    public List<Patient> getPatByDocId(String docId) {
        return appointmentMapper.getPatByDocId(docId);
    }

    public Appointment getById(String id) {
        return appointmentMapper.getById(id);
    }

    public Appointment setState(String id, String stateId) {
        appointmentMapper.setState(id, stateId);
        return appointmentMapper.getById(id);
    }

    public int getCount() {
        return appointmentMapper.getCount();
    }

    public int getCountByDocId(String docId) {
        return appointmentMapper.getCountByDocId(docId);
    }

    public void update(Appointment appointment) {
        appointmentMapper.update(appointment);
    }

    public void insert(Appointment appointment) {
        appointmentMapper.insert(appointment);
    }

    public void delete(String id) {
        appointmentMapper.deleteById(id);
    }

    public List<Appointment> getAppointmentByDateAndClinic(String date, String clinicId) {
        return appointmentMapper.getAppointmentByDateAndClinic(date, clinicId);
    }

    public int getAppointmentCount(String date, String clinicId, String docId, int stage) {
        return appointmentMapper.getAppointmentCount(date, clinicId, docId, stage);
    }

    public int getAppointmentPeriodCount(String date, String clinicId, String docId, int stage, int period) {
        return appointmentMapper.getAppointmentPeriodCount(date, clinicId, docId, stage, period);
    }

    public int getAppointmentByPatIdAndNgState(String patientId) {
        return appointmentMapper.getAppointmentByPatIdAndNgState(patientId);
    }



}
